package user.zc.excel.render;

import user.zc.excel.data.info.ICell;
import org.apache.poi.xssf.usermodel.XSSFCell;
import org.apache.poi.xssf.usermodel.XSSFRow;

class RowRender implements ICreate<XSSFCell, ICell.CellInfo[]>  {
    private Integer index = 0;
    XSSFRow xssfRow;
    public RowRender(XSSFRow xssfRow){
        this.xssfRow = xssfRow;
    }

    @Override
    public XSSFCell next() {
        return xssfRow.createCell(index++);
    }

    @Override
    public void draw(ICell.CellInfo[] data) {
        for (ICell.CellInfo datum : data) {
            new CellRender(next()).draw(datum);
        }
    }
}
